package com.fjwt.gz.task.audit;

import cn.hutool.core.date.DateUtil;
import com.fjwt.gz.core.utils.SpringBeansUtil;
import com.fjwt.gz.service.impl.ActivityService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * 超时未审核 自动进行驳回
 */
@Component
@Slf4j
public class TimeoutAuditTask {

    @Autowired
    private ActivityService activityService;

//    @Scheduled(cron = "${cron.TimeoutAuditTask}") // 每天0点执行一次
    @Transactional
    public void timeout() {
        log.info("超时未审核定时任务开始执行任务：{}", DateUtil.now());
        activityService.timeout();
        log.info("超时未审核定时任务执行完成：{}", DateUtil.now());
    }
}
